const express = require('express')
const router = express.Router()

router.get('/set', (req, res) => {
  const userinfo = {'userid': 7322, 'username': 'plain', 'nickname': 'plain', 'useremail': 'welcome@haosuzhou.com', 'groupid': 2, 'avatar': 'http://www.ikanfan.com/avatar/avatar.php?uid=000007322&&size=big', 'lastdate': 1526610852, 'lastip': '1699816818', 'user_email_auth': '0'}
  res.cookie('test', userinfo, { path: '/', maxAge: 1000 * 60 * 60 * 24 * 30 })
  res.send({ success: true, setData: userinfo, cookieName: 'test', dataString: JSON.stringify(userinfo), getData: req.cookies, getFunc: 'req.cookies' })
})

router.get('/get', (req, res) => {
  res.send({ success: true, cookieName: 'test', data: req.cookies })
})

module.exports = router
